<include file="Public/head" />
<style type="text/css">
    .lottory_detail{text-align:left;}
    .lottory_detail p{height:25px;line-height:25px;font-size:14px;font-weight:bolder;padding-left:2px;color:#20ab4f;}
    .lot_input{border: 1px solid #d7d7d7;float: left;height: 24px;line-height: 24px;margin: 0 10px 10px 0;text-align: center;width: 150px;}
    #lt_type,#lt_status{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 110px 5px;border: 1px solid #d7d7d7;color: #666;
        float: left;font-family: "微软雅黑";height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 130px;}
     .xiaci1{
        background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}/paimai/yunying/images/yun_tubiao1.jpg") no-repeat scroll 130px 4px;border: 1px solid #d7d7d7;float: left;
        height: 24px;line-height: 24px;margin-right: 10px;padding-left: 10px;text-align: left;width: 140px;}
    .table thead tr > td
    ,.table tbody tr>td {text-align: center;vertical-align:middle; }
    .chenggong1 .paidan{padding-top:30px;}
    .paidan h3{font-size:16px;color:#000;margin-bottom: 30px;}
    .shenhei-btn{margin-top:30px;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="hdgl.cjgl" />
    <div class="mianR">
        <h3 class="cha">奖券列表</h3>
        <div class="lottory_detail">
            <p>活动名称：{$lottory.lottory_name}</p>
            <p>活动编号：{$lottory.id}</p>
        </div>
        <div class="lottory yuSuo clearfix">
            <form id="searchFrom">
                <input type="text" name="lt_num" placeholder="请输入奖券号" class="lot_input"/>
                <select name="lt_type" id="lt_type">
                    <option value="">全部类型</option>
                    <option value="1">自主注册</option>
                    <option value="2">邀请注册</option>
                    <option value="3">受邀注册</option>
                </select>                
                <input type="text" name="lt_uid" placeholder="请输入个人ID" class="lot_input"/>
                <input type="text" name="lt_phone" placeholder="请输入帐号" class="lot_input"/>
                <input type="text" name="invite_uid" placeholder="邀请人ID" class="lot_input"/>
                <select name="lt_status" id="lt_status">
                    <option value="">全部开奖情况</option>
                    <option value="1">已中奖</option>
                    <option value="2">未中奖</option>
                </select>
                <div class="clear"></div>
                <input type="text" name="start_time" placeholder="开始时间" value="" class="xiaci1 xin-text" id="lottory_start_time" readonly>
                <input type="text" name="end_time"  placeholder="结束时间" value="" class="xiaci1 xin-text" id="lottory_end_time" readonly />
                <input type="hidden" value="{$lot_id}" name="lot_id">
                <input type="button" value="筛选"  class="suoSou" name="lottory_ticket_search"/>
                <input type="button" value="全部" onclick="location.href = '/Lottory/lottoryTicket/id/{$lottory.id}'" class="suoSou" />
            </form>
        </div>
        <div class="yunBei" style="z-index:999998"></div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
        <div class="yongBtn1">
            <input class="quxiao" type="button" value="关闭" onclick="window.close();">
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null)
                return unescape(r[2]);
            return null; //返回参数值
        }
        get_list();
        function get_list() {
            var url = mkUrl();
            var p = getUrlParam('p');
            if (p != null) {
                var purl = "?p=" + p;
            } else {
                var purl = "?p=1";
            }
            $.get("/Lottory/lottoryTicketList" + purl, url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }
        function get_page(p) {
            var url = mkUrl();
            $.get("/Lottory/lottoryTicketList/" + encodeURI("p/" + p), url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }

        $("input[name='lottory_ticket_search']").click(function () {
            get_list();
        });
        function mkUrl() {
            var url = "";
            var lot_id = $("input[name='lot_id']").val();
            var lt_num = $("input[name='lt_num']").val();
            var lt_type = $("#lt_type").val();
            var lt_uid = $("input[name='lt_uid']").val();
            var lt_phone = $("input[name='lt_phone']").val();
            var invite_uid = $("input[name='invite_uid']").val();
            var lt_status = $("#lt_status").val();
            var start_time = $("input[name='start_time']").val();
            var end_time = $("input[name='end_time']").val();
            if (lot_id) {
                url += '&lot_id=' + lot_id;
            }
            if (lt_num) {
                url += '&lt_num=' + lt_num;
            }
            if (lt_type) {
                url += '&lt_type=' + lt_type;
            }
            if (lt_uid) {
                url += '&lt_uid=' + lt_uid;
            }
            if (lt_phone) {
                url += '&lt_phone=' + lt_phone;
            }
            if (invite_uid) {
                url += '&invite_uid=' + invite_uid;
            }
            if (lt_status) {
                url += '&lt_status=' + lt_status;
            }
            if (start_time) {
                url += '&start_time=' + start_time;
            }
            if (end_time) {
                url += '&end_time=' + end_time;
            }
            return url;
        }
    
    function confirm_popup(lot_id, lot_status,lot_name) {
        if (lot_status == '2') {
            msg = '确认上线活动<br/>'+'"'+lot_name+'"';
            htext = "活动上线";
        } else {
            msg = '确认下线活动<br/>'+'"'+lot_name+'"';
            htext = "活动下线";
        }
        text = '<div style="color:red">' + msg + '</div>';
        var html = '<div class="chenggong1">\n\
                    <span class="paidan"><h3>' + htext + '</h3>' + text + '</span>\n\
                    <div class="shenhei-btn"><input type="button" value="确定" class="determine" />\n\
                    <input type="button" value="取消" class="cancel" onclick="colse_hide()" />\n\
                    </div></div>';
        $(".yunBei").css("display", "block");
        $(document.body).append(html);
        $(".chenggong1").fadeIn();
        confirm(lot_id, lot_status);
    }
    function confirm(lot_id, lot_status) {
        $('.determine').click(function () {
            colse_hide();
            change_lottory_status(lot_id, lot_status);
        });
    }
    /**
    * 上下、下线操作
    * @param {type} c_id
    * @param {type} status
    * @returns {Boolean}
    */
   function change_lottory_status(lot_id, lot_status) {
       var post_data = {lot_id: lot_id, lot_status: lot_status};
       $.post('/Lottory/changeLottoryStatus', post_data, function (res) {
           if (res.code == 200) {
               delay_alert('操作成功!');
               setTimeout(function () {
                   window.location.reload();
               }, 500);
           } else {
               delay_alert(res.msg);
           }
       }, 'json');
       return false;
   }
    
    $("#lottory_start_time").ymdateplugin({
//        showTimePanel: true,
//        changeMonth: true,
//        changeYear: true
    });
    $("#lottory_end_time").ymdateplugin({
//        showTimePanel: true,
//        changeMonth: true,
//        changeYear: true
    });

    </script>
    <include file="Public/foot" />